Load the spatial data
library(tidyverse)
## Loading tidyverse: ggplot2
## Loading tidyverse: tibble
## Loading tidyverse: tidyr
## Loading tidyverse: readr
## Loading tidyverse: purrr
## Loading tidyverse: dplyr
## Conflicts with tidy packages ----------------------------------------------
## filter(): dplyr, stats
## lag(): dplyr, stats
library(sf)
## Warning: package 'sf' was built under R version 3.4.3
## Linking to GEOS 3.6.1, GDAL 2.2.0, proj.4 4.9.3
library(tmap)
## Warning: package 'tmap' was built under R version 3.4.3
sb_fm <- st_read(dsn = ".", layer = "fhszs06_3_42")
## Reading layer `fhszs06_3_42' from data source `H:\Week 3 Bootstrapping NOLS\testapp\fire_app\fire' using driver `ESRI Shapefile'
## Simple feature collection with 379 features and 5 fields
## geometry type: MULTIPOLYGON
## dimension: XY
## bbox: xmin: -61171.23 ymin: -404141.7 xmax: 51052.63 ymax: -322577.5
## epsg (SRID): NA
## proj4string: +proj=aea +lat_1=34 +lat_2=40.5 +lat_0=0 +lon_0=-120 +x_0=0 +y_0=-4000000 +datum=NAD83 +units=m +no_defs
sb_proj <- st_transform(sb_fm, "+init=epsg:4326")
Make a really simple plot
plot(sb_proj['HAZ_CLASS'])
simplify dataset
sb_hc <- sb_proj %>%
select(HAZ_CLASS)
Make a map!
tm_shape(sb_hc) +
tm_polygons("HAZ_CLASS", title = "SB Fire Hazard Severity")
tmap_mode("view")
## tmap mode set to interactive viewing
last_map()